<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">投诉建议</block>
		</cu-custom>
				
		<view class="padding flex flex-direction">
			<view class="cu-form-group">
				<view class="title">标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题：</view>
				<input placeholder="请输入标题" name="input" v-model="title"></input>
			</view>
		</view>
		
		<view class="padding flex flex-direction">
			<view class="cu-form-group">
				<view class="title">建议内容：</view>
				<textarea @blur="bindTextAreaBlur" auto-height placeholder="请输入内容" v-model="content"></textarea>
			</view>
		</view>
		
		<view class="padding flex flex-direction">
			<app-select label="类    型：" v-model="type" placeholder="请选择类型" :dict="plan_type" space ></app-select>
		</view>
		
		<view class="padding flex flex-direction">
			<app-select label="优 先 级：" v-model="priority" placeholder="请选择类型" :dict="priority_type" space ></app-select>
		</view>
		
		<view class="padding flex flex-direction">
			<button class="cu-btn bg-blue lg"  @click="onSubmit">提交</button>
		</view>
	</view>
</template>

<script>
	const plan_type = [{text:'投诉',value:'0'},{text:'建议',value:'1'}];
	const priority_type = [{text:'0',value:'0'},{text:'1',value:'1'},{text:'2',value:'2'},{text:'3',value:'3'}];
	import appSelect from '@/components/my-componets/appSelect.vue'
	
	 export default {
	 	name: 'addComplaintSuggestion',
		data() {
			return {
				plan_type,
				priority_type,
				type:"0",
				content: "",
				title: "",
				priority: "0",
			}
		},
		methods: {
			onSubmit() {
				let temp = {
					submiter: this.$store.getters.userid,
					title: this.title,
					content: this.content,
					type: parseInt(this.type),
					priority: parseInt(this.priority),
				}
				console.log(temp)
				this.$http.post('/property/znzfComplaint/add',temp).then(res => {
					console.log(res)
					if(res.data.code == 200)
					 this.$tip.success('提交成功!')
					else this.$tip.success('提交失败!')
				})
			},
			bindTextAreaBlur: function (e) {
				console.log(e.detail.value)
			}
		},
		components:{
		    appSelect
		 },
	 }
</script>

<style lang='scss'>
</style>
